window.workspace = function(){
	var response  = <?#$respons?>;
	var sid = {'userid':Ext.id(), 'bzsn':Ext.id(), 'paysn':Ext.id(), 'status':Ext.id(), 'sdate':Ext.id(), 'edate':Ext.id()};
	var store, sm, grid;
	store = new Ext.data.JsonStore({
	    autoDestroy	: true,
	    url			: '/admin/live/finance/payrecord/dolist.html',
	    remoteSort	: true,
	    sortInfo	: {
            field		: 'id',
            direction	: 'DESC'
		},
		baseParams	: {
			start	: 0,
			limit	: main.pageSize
		},
		autoLoad		: true,
	    root			: 'dataset',
	 	totalProperty	: 'total',
	    fields			: ['id', 'userid', 'nickname', 'bzsn', 'paysn', 'money', 'coin',
	        'addtime', 'paytime', 'paytype', 'refid', 'status', 'ip', 'memo', 'stime']
	});
	sm   = new Ext.grid.CheckboxSelectionModel();
 	grid = {
		xtype		: 'grid',
		title		: response.title,
	    store		: store,
		region		: 'center', 
	    columns		: [
	        sm,
			{header: '编号[ID]', width:50, sortable:true, dataIndex:'id'},
			{header: '订单号[OrderNumber]', width:90, dataIndex:'paysn'},
			{header: 'PS订单号[PSocialFlowNumber]', width:60, dataIndex:'bzsn'},
			{header: '充值用户[PayUser]', width:80, dataIndex:'nickname', renderer:function(v,meta,obj){
				return v+'['+obj.get('userid')+']';
			}},
			{header: '充值金额[Amount]', width:60, dataIndex:'money', sortable:true, renderer:function(v,meta,obj){
				return v / 100.00;
			}},
			{header: '获得代币[Coins]', width:60, sortable:true, dataIndex:'coin'},
			{header: '订单状态[Status]', width:60, dataIndex:'status', sortable:true, renderer:function(v,meta,obj){
				return response.status[v];
			}},
			{header: '下单时间[AddTime]', width:100, dataIndex:'addtime'},
			{header: '付款时间[PayTime]', width:100, dataIndex:'paytime'},
			{header: '支付方式[PayMethod]', width:80, sortable:true, dataIndex:'paytype'},
			{header: '付款IP[IP]', width:80, dataIndex:'ip'},
			{header: '支付备注[Notes]', width:160, dataIndex:'memo', renderer:function(v,meta,obj){
				return (obj.get('refid') > 0)? v+'['+obj.get('refid')+']':v;
			}},
			{header: '更新时间[LastTime]',width:100,dataIndex:'stime'}
		],
	    viewConfig	: {
	        forceFit	 : true,
	        scrollOffset : 0
	    },
	    listeners	: {
			'render': function(obj){
				main.gridRender(obj, ['memo']);
			}
		},
	    sm			: sm,
	    stripeRows	: true,
	    tbar		: [{
			text	: '刷新[Reload]',
			iconCls	: 'icon-refresh',
			handler : function(){
				store.reload(); 
			}
	    },'-','充值用户:',{
			xtype		: 'combo',
			store		: new Ext.data.JsonStore({
				url	: '/admin/live/share/douser.html',
				autoDestroy: true,
				fields: ['id', 'name'],
				root: 'dataset'
			}),
			id	    	    : sid.userid,
			displayField	: 'name',
			valueField		: 'id',
			emptyText		: 'Selected...',
			minChars		: 1,
			 pageSize		: 10,
			listWidth		: 258,
			width			: 160,
			typeAhead		: true,
			typeAheadDelay  : 0,
			triggerAction	: 'all',
			enableKeyEvents : true,
			mode			: 'remote'
		},'-','订单号:',{
			xtype       : 'textfield',
			id	    	: sid.paysn,
			width	    : 120
		},'PS订单号:',{
			xtype       : 'textfield',
			id	    	: sid.bzsn,
			width	    : 80
		},'-','订单状态:',{
			xtype		: 'combo',
			store		: new Ext.data.ArrayStore({
		        fields: ['id','name'],
		        data: main.cv2Array(response.status)
		    }),
			displayField	: 'name',
			valueField		: 'id',
			mode			: 'local',
			autoSelect 		: true, 
			triggerAction	: 'all',
			width			: 80,
			id  			: sid.status
		},'-','PayTime:',{
			xtype       : 'datefield',
			id	    	: sid.sdate,
			format		: 'Y-m-d',
			width	    : 100
		},'<->',{
			xtype       : 'datefield',
			id	    	: sid.edate,
			format		: 'Y-m-d',
			width	    : 100
		},'-',{
			text		: '检索',
			iconCls		: 'icon-search',
			handler: function() {
				store.baseParams.userid = Ext.getCmp(sid.userid).getValue();
				store.baseParams.paysn  = Ext.getCmp(sid.paysn).getValue();
				store.baseParams.bzsn   = Ext.getCmp(sid.bzsn).getValue();
				store.baseParams.status = Ext.getCmp(sid.status).getValue();
				store.baseParams.sdate  = Ext.getCmp(sid.sdate).getValue();
				store.baseParams.edate  = Ext.getCmp(sid.edate).getValue();
				store.reload(); 
			}
		}],
		bbar		: new Ext.PagingToolbar({
			pageSize	: main.pageSize,
			store		: store,
			displayInfo	: true
		})
	};
	return grid;
}();